package windbell.domain.risk.proxy;

import com.google.gwt.user.client.rpc.IsSerializable;
import windbell.domain.risk.proxy.RiskReportAction;

public class RiskReportManager implements IsSerializable {
  public static Boolean isActionValid(final RiskReportAction action, final String state) {
    if(action==null||state==null) return false;
    switch(action){
    	case update:{
    		return "created".equals(state);
    	}
    	case createDocument:{
    		return "created".equals(state);
    	}
    	case removeDocument:{
    		return "created".equals(state);
    	}
    	case finish:{
    		return "created".equals(state);
    	}
    	case reopen:{
    		return "finished".equals(state);
    	}
    	default:
    		return false;
    }
    
  }
  
  public static Boolean isActionValid(final RiskReportAction action, final Enum<?> state) {
    return isActionValid(action,state.name());
    
  }
}
